﻿using System;
using System.Collections.Generic;

namespace Sustainalytics.Utils
{
    public class PortfolioUserClaims
    {
        public Guid AccountId { get; set; }

        public List<int> Universes { get; private set; }

        public string UserFullName { get; set; }

        public Guid UserId { get; set; }

        public string UserName { get; set; }

        public static bool PortfolioClaimsAreValid(PortfolioUserClaims userClaims)
        {
            return userClaims != null && !string.IsNullOrEmpty(userClaims.UserFullName) &&
                    !string.IsNullOrEmpty(userClaims.UserName);
        }

        public void AddAccountUniverses(IEnumerable<int> universes)
        {
            if (universes.IsNullOrEmpty())
            {
                return;
            }

            if (this.Universes == null)
            {
                this.Universes = new List<int>();
            }

            this.Universes.AddRange(universes);
        }
    }
}
